package pl.com.britenet.myredmine.dao.mdb.domain;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.ForeignKey;

/**
 * Domain class for table PERSON_PROJECT.
 * 
 * @author <a href="mailto:pawel.sprysak@britenet.com.pl">Paweł Sprysak</a>
 * 
 */
@Entity
@Cache(region = "operiationalWithoutVersion", usage = CacheConcurrencyStrategy.READ_WRITE)
//TODO: Make annotation and LightEntity
//@GenService
@Table(name = "PERSON_PROJECT")
public class PersonProject implements Serializable {  //extends LightEntity

    /**
     * Serial number.
     */
    private static final long serialVersionUID = -7662037476649929571L;
    
    /**
     * User.
     */
    @Id
    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "USERS_ID", nullable = false)
    @ForeignKey(name = "FK_PERSON_PROJECT_USER")
    private Users user;
    
    /**
     * Corporate Role.
     */
    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "PROJECT_ID", nullable = false)
    @ForeignKey(name = "FK_PERSON_PROJECT_PROJECT")
    private Project project;
    
    /**
     * Setter for property "user".
     * 
     * @param user
     *            Value of property "user".
     */
    public void setUser(Users user) {
        this.user = user;
    }

    /**
     * Getter for property "user".
     * 
     * @return Value of property "user".
     */
    public Users getUser() {
        return user;
    }

    /**
     * Setter for property "project".
     * 
     * @param project
     *            Value of property "project".
     */
	public void setProject(Project project) {
		this.project = project;
	}

    /**
     * Getter for property "project".
     * 
     * @return Value of property "project".
     */
	public Project getProject() {
		return project;
	}
}
